/*
 * @Descripttion:
 * @version:
 * @Author: wangpei
 * @Date: 2021-08-30 09:49:42
 * @LastEditors: wangpei
 * @LastEditTime: 2022-08-08 15:44:11
 */
import { i18n } from './setupI18n';
import { useLocaleStoreWithOut } from '@/store/modules/locale';
import { unref, computed } from 'vue';

export function useLocale() {
  const localeStore = useLocaleStoreWithOut();
  const getLocale = computed(() => localeStore.getLocale);

  const getAntdLocale = computed((): any => {
    return i18n.global.getLocaleMessage(unref(getLocale))?.antdLocale ?? {};
  });

  return {
    getLocale,
    getAntdLocale,
  };
}
